﻿

$(function () {
    //四级定位
    $("#personMenuContent,#monitorMenuContent,#eventsMenuContent,#houseMenuContent,#hujiMenuContent").on("click", ".work-child-item", function () {
        var oEntity = viewer.entities.getById($(this).attr("data-id"));
        if (!oEntity) {
            return;
        } else if ($(this).parents(".work-child-content").hasClass("isHide")) {
            return;
        }
        viewer.flyTo(oEntity);
    });


    //人员列表ALL
    $(".list").click(function () {
        if ($(this).parents(".work-menu-sub-item").attr("data-menu") == "person") {
            layer.config({
                extend: 'myskin/style.css',
                skin: "trouble-handle people"
            });
            var aArea = ['auto', '500px'];
            /*if(window.innerWidth<=1700){
            aArea=['100%',  '500px'];
            }*/
            $("#renyuan").find("thead tr th.wangge").remove();
            $("#renyuan").find("thead tr").prepend("<th class=\"wangge\">网格</th>");
            fnLoadGridPropInfo("", "renyuan", "all");
            layer.open({
                type: 1, //Page层类型
                title: "人员管理",
                shade: 0.01, //遮罩透明度
                area: aArea,
                anim: -1, //0-6的动画形式，-1不开启
                content: $("#graphical-chart")//'pop-grid-property.html?gridnum=&type=renyuan&field=all'
            });
        }
    });


    //每个栏目全选
    $("#peopleAllCheck,#monitorAllCheck,#eventAllCheck,#houseAllCheck").click(function () {
        var oThis = $(this).find(".allCheck");
        var parentX = $(this).parent().parent();
        if (oThis.hasClass("active")) {
            oThis.removeClass("active");
            parentX.find(".check").removeClass("active");
            parentX.find(".work-child-content").addClass("isHide");
            parentX.find(".work-child-item").attr("title", "请先勾选地图显示，再查看具体信息");
            parentX.find(".work-child-item").each(function () {
                var dataId = $(this).attr("data-id");
                mark.showMark(dataId, false);
            });
        } else {
            oThis.addClass("active");
            parentX.find(".check").addClass("active");
            parentX.find(".work-child-content").removeClass("isHide");
            parentX.find(".work-child-item").attr("title", "");
            parentX.find(".work-child-item").each(function () {
                var dataId = $(this).attr("data-id");
                
                console.log(99, dataId)
                mark.showMark(dataId, true);
            });
        }
    });
});



